<?php
$this->Html->addCrumb('Employee List');
?>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link($this->Html->image('buttons/add-button-50px.png', array(
															'alt'=>'Add',
																)
															), array('action' => 'add'), array('data-toggle' => 'modal', 'data-target' => '#addModal', 'escape'=>false)); ?>
		</li>
	</ul>
</div>
<div class="modal fade hide" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
			<h3 id="myModalLabel">New Employee</h3>
		</div>
		<div class="modal-body">
        <p style="text-align:center;"><img src="img/loading.gif" id="loading-indicator" /><br />Loading Please Wait</p>
		</div>
</div>
<div class="employeesIndex">
	<h2><?php echo __('Employees'); ?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('e_fname', 'First Name'); ?></th>
			<th><?php echo $this->Paginator->sort('e_lname', 'Last Name'); ?></th>
			
			<th><?php echo $this->Paginator->sort('e_mobilephone', 'Mobile'); ?></th>
			<th><?php echo $this->Paginator->sort('e_email', 'Email'); ?></th>
			<th><?php echo $this->Paginator->sort('e_joblevel', 'Job Level'); ?></th>
			<th><?php echo $this->Paginator->sort('e_jobtype', 'Job Type'); ?></th>
			<th><?php echo $this->Paginator->sort('e_status', 'Status'); ?></th>
			<th class="actions"><?php echo __('Actions'); ?></th>
	</tr>
	<?php foreach ($employees as $employee): ?>
	<tr>
		<td><?php echo h($employee['Employee']['e_fname']); ?>&nbsp;</td>
		<td><?php echo h($employee['Employee']['e_lname']); ?>&nbsp;</td>
		
		<td><?php echo h($employee['Employee']['e_mobilephone']); ?>&nbsp;</td>
		<td><?php echo h($employee['Employee']['e_email']); ?>&nbsp;</td>
		<td><?php
		//Displaying Latest Changed Joblvl
		$jobLvlDesc = end($employee['EmployeeJobLvl']);
		echo $jobLvlDesc['joblvl']['joblvl_desc']; ?></td>
		<td><?php 
		//Displaying Latest Changed JobType
		$jobTypeDesc = end($employee['EmployeeJobType']);
		echo $jobTypeDesc['jobtype']['jobtype_desc']; ?></td>
		<td><?php 
		//Displaying Latest Changed JobStatus
		$jobStatusDesc = end($employee['EmployeeJobStatus']);
		echo $jobStatusDesc['jobstatus']['jobstatus_desc']; ?></td>
		<td class="actions">
			<?php echo $this->Html->link(__('View'), array('action' => 'view', $employee['Employee']['e_id'])); ?>
			<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $employee['Employee']['e_id'])); ?>
			<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $employee['Employee']['e_id']), null, __('Are you sure you want to delete # %s?', $employee['Employee']['e_id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
		<div class="paging"><p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page {:page} of {:pages}')
	));
	?>	</p>

	<?php
		echo $this->Paginator->prev('< ' . __('Previous '), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('Next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>
